<template>
    <div>
        <div class="shrinkageBox">
           <!-- 菜单 -->
           <div class="shrinkageBox-tools flex flex-align-center">
               <div class="shrinkageBox-tools-left">
                   <p class="tools-tips">缩水工具</p>
                   <div class="tools-box flex flex-align-center">
                       <div class="tools-box-item tools-box-item-left" :class="{'item-active':itemIndex==1}" @click="onChangeTab"><p>123位缩水工具</p></div>
                   </div>
               </div>
               <div class="shrinkageBox-tools-left shrinkageBox-tools-right" v-if='false'>
                   <p class="tools-tips">更多功能</p>
                   <div class="tools-box flex flex-align-center">
                       <div class="tools-box-item" :class="{'item-active':itemIndex==4}" @click="onChangeTab"><p>多能缩水工具</p></div>
                   </div>
               </div>
           </div>
            <div class="toolsBox flex">
                <!-- 左边部分 -->
                <div class="toolsBox-left flex flex-v">
                    <!-- 最大号/最小号 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in codeArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,0,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,0,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,0,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,0,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h"></div>
                    </div>
                    <!-- 跨度 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in crossspanArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,1,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,1,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,1,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,1,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h"></div>
                    </div>
                    <!-- 类型 -->
                     <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in typeArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,2,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,2,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,2,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,2,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h"></div>
                    </div>
                    <!-- 连号 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in linkCodeArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,3,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,3,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,3,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,3,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h"></div>
                    </div>
                    <!-- 和值大小 -->
                    <div class="numBox hezhiBox"  style="border:none">
                        <div v-for='(item,index) in sumsizeArr' :key="index" class=" flex">
                            <div class="nomRow flex flex-align-center" style="width: 1.35rem">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,4,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,4,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,4,item.digit)">
                            </div>
                            <div class="numBox" style="min-height:0.1rem">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,4,item.digit,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                    </div>
                    <!-- 和值单双 -->
                   <div class="numBox hezhiBox"  style="border:none">
                        <div v-for='(item,index) in sumoddevenArr' :key="index" class=" flex">
                            <div class="nomRow flex flex-align-center" style="width: 1.35rem">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,5,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,5,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,5,item.digit)">
                            </div>
                            <div class="numBox" style="min-height:0.1rem">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,5,item.digit,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                    </div>
                    <!-- 和值 -->
                    <div class="numBox hezhiBox"  style="border:none">
                        <div v-for='(item,index) in sumArr' :key="index" class=" flex">
                            <div class="nomRow flex flex-align-center" style="width:1.1rem">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,6,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,6,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,6,item.digit)">
                            </div>
                            <div class="numBox">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,6,item.digit,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 缩水工具右边栏 -->
                <div class="toolsBox-right">
                    <!-- 胆码 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in biliaryArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,7,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,7,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,7,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,7,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h" style="height:0.15rem"></div>
                    </div>
                    <!-- 大小比/奇偶比/质合比 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in sizeradioArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,8,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,8,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,8,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,8,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h" style="height:0.15rem"></div>
                    </div>
                    <!-- 012路 -->
                    <div class="numBox hezhiBox" style="border-bottom:solid 1px #ddd">
                        <div v-for='(item,index) in type012Arr' :key="index" class=" flex">
                            <div class="nomRow flex flex-align-center">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,9,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,9,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,9,item.digit)">
                            </div>
                            <div class="numBox">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,9,item.digit,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                    </div>
                    <!-- 二不同号 -->
                    <div class="numBox hezhiBox">
                        <div v-for='(item,index) in twodiffArr' :key="index" class=" flex">
                            <div class="nomRow flex flex-align-center" style=" width: 1.35rem;">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,10,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,10,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,10,item.digit)">
                            </div>
                            <div class="numBox">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,10,item.digit,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                    </div>
                    <!-- 操作面板 -->
                    <div class="numBox" style="border:none;">
                        <div class="hezhi-Tools">
                                <div class="TabsBox flex">
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onGenerateFun">
                                        <img src="@/assets/img/shrinkagetool/shengc.png" alt="">
                                        <p>生成</p>
                                    </div>
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onRotationGroupFun">
                                        <img src="@/assets/img/shrinkagetool/zzx.png" alt="">
                                        <p>转组选</p>
                                    </div>
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onExportFun">
                                        <img src="@/assets/img/shrinkagetool/dc.png" alt="">
                                        <p>导出</p>
                                    </div>
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onCopyFun">
                                        <img src="@/assets/img/shrinkagetool/fz.png" alt="">
                                        <p>复制</p>
                                    </div>
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onResetFun">
                                        <img src="@/assets/img/shrinkagetool/cz.png" alt="">
                                        <p>重置所有条件</p>
                                    </div>
                                </div>
                                <p class="tips">本次生成{{total_num}}注</p>
                        </div>
                    </div>
                </div>
            </div> 
            <div class="Num-Box">
                <textarea readonly='true' v-model="NumVal" id='textCont'></textarea>
           </div>    
        </div>
    </div>
</template>
<script>
import Date from '@/assets/js/shrinkagetool123json';
import Date_k3 from '@/assets/js/shrinkagetool123_k3json';
export default {
    data () {
        return {
             itemIndex:1,
             total_num:0, //生成注数
             NumVal:'', //生成数据
             is_client_export:0, //是否导出数据
             is_turn:0, //是否转组选
             star_num:0, //几星缩水
             file_name:'123位缩水结果',
             // 数据初始化  
             codeArr:[], //最大号/最小号
             crossspanArr: [], //跨度
             typeArr:[], //类型
             linkCodeArr: [], //连号
             sumsizeArr: [],  //和值大小
             sumoddevenArr: [], //和值单双
             sumArr: [], //和值
             biliaryArr: [], //胆码
             sizeradioArr: [], //奇偶质合比
             type012Arr: [], //012路
             twodiffArr: [], //二不同号

             // 杀码、定码类型选择
             max_code_type:1, //最大号
             min_code_type:1,  //最小号
             hundred_biliary_code_type:1, //百位胆码
             ten_biliary_code_type:1, // 十位胆码
             position_biliary_code_type:1, // 个位胆码
             cross_span_code_type:1, // 跨度
             code_type_type:1, // 类型
             code_size_type:1, // 大小比
             parity_radio_code_type:1, // 奇偶比
             mass_radio_code_type:1, // 质合比
             link_code_type:1, // 连号
             code_type_012_type:1, // 012
             code_sum_size_type:1,  // 合值大小
             code_sum_odd_even_type:1, // 合值奇偶
             sum_code_type:1,  // 合值
             two_diff_code_type:1, // 2不同号

            //  各参数数组
             max_code_data:[],
             min_code_data:[],
             hundred_biliary_code_data:[],
             ten_biliary_code_data:[],
             position_biliary_code_data:[],
             cross_span_code_data:[],
             code_type_data:[],
             code_size_data:[],
             parity_radio_code_data:[],
             mass_radio_code_data:[],
             link_code_data:[],
             code_type_012_data:[],
             code_sum_size_data:[],
             code_sum_odd_even_data:[],
             sum_code_data:[],
             two_diff_code_data:[],
        }
    },
    mounted () {
        this.onSetDatafun();
    },
    watch: {
        // 监听彩种变化，改变页面数据，
        CaiPiaoType(){
            this.onSetDatafun();
        },
        CaiPiaoId(){
            this.resetNum();
        }
    },
    computed: {
        CaiPiaoType(){
            return this.$store.state.CaiPiaoType;
        },
        CaiPiaoId(){
            return this.$store.state.lottery_id;
        }
    },
    methods: {
        // 切换几位缩水
        onChangeTab(ele){
           if(ele.target.innerText == '123位缩水工具'){
               this.itemIndex = 1;
           }else if(ele.target.innerText == '多能缩水工具'){
               this.itemIndex = 4;
           }
        },

        // 构造数据
        onSetDatafun(){
            if(this.CaiPiaoType == 'l28'){
                this.codeArr = Date.codeArr;
                this.crossspanArr = Date.crossspanArr;
                this.typeArr = Date.typeArr;
                this.linkCodeArr = Date.linkCodeArr;
                this.sumsizeArr = Date.sumsizeArr;
                this.sumoddevenArr = Date.sumoddevenArr;
                this.sumArr = Date.sumArr;
                this.biliaryArr = Date.biliaryArr;
                this.sizeradioArr = Date.sizeradioArr;
                this.type012Arr = Date.type012Arr;
                this.twodiffArr = Date.twodiffArr;
            }else if(this.CaiPiaoType == 'k3'){
                this.codeArr = Date_k3.codeArr;
                this.crossspanArr = Date_k3.crossspanArr;
                this.typeArr = Date_k3.typeArr;
                this.linkCodeArr = Date_k3.linkCodeArr;
                this.sumsizeArr = Date_k3.sumsizeArr;
                this.sumoddevenArr = Date_k3.sumoddevenArr;
                this.sumArr = Date_k3.sumArr;
                this.biliaryArr = Date_k3.biliaryArr;
                this.sizeradioArr = Date_k3.sizeradioArr;
                this.type012Arr = Date_k3.type012Arr;
                this.twodiffArr = Date_k3.twodiffArr;
            }
        },

        // 定码、杀码
        onChangedmBox(ele,type,group){
            if(type === 0){
                this.codeArr[ele].isChangedmBox = !this.codeArr[ele].isChangedmBox;
                if(this.codeArr[ele].isChangedmBox){
                    switch(group){
                        case '最大号': this.max_code_type = 2;break;
                        case '最小号': this.min_code_type = 2;break;
                    }
                }else{
                     switch(group){
                        case '最大号': this.max_code_type = 1;break;
                        case '最小号': this.min_code_type = 1;break;
                    }
                }
            }else if(type === 1){ //跨度
                this.crossspanArr[ele].isChangedmBox = !this.crossspanArr[ele].isChangedmBox;
                if(this.crossspanArr[ele].isChangedmBox){
                    this.cross_span_code_type = 2;
                }else{
                     this.cross_span_code_type = 1;
                }
            }else if(type === 2){ //类型
                this.typeArr[ele].isChangedmBox = !this.typeArr[ele].isChangedmBox;
                if(this.typeArr[ele].isChangedmBox){
                    this.code_type_type = 2;
                }else{
                     this.code_type_type = 1;
                }
            }else if(type === 3){ // 连号
                this.linkCodeArr[ele].isChangedmBox = !this.linkCodeArr[ele].isChangedmBox;
                if(this.linkCodeArr[ele].isChangedmBox){
                    this.link_code_type = 2;
                }else{
                     this.link_code_type = 1;
                }
            }else if(type === 4){ //大小合值
                this.sumsizeArr[ele].isChangedmBox = !this.sumsizeArr[ele].isChangedmBox;
                if(this.sumsizeArr[ele].isChangedmBox){
                    this.code_sum_size_type = 2;
                }else{
                     this.code_sum_size_type = 1;
                }
            }else if(type === 5){ //大小单双
                this.sumoddevenArr[ele].isChangedmBox = !this.sumoddevenArr[ele].isChangedmBox;
                if(this.sumoddevenArr[ele].isChangedmBox){
                    this.code_sum_odd_even_type = 2;
                }else{
                     this.code_sum_odd_even_type = 1;
                }
            }else if(type === 6){ //和值
                this.sumArr[ele].isChangedmBox = !this.sumArr[ele].isChangedmBox;
                if(this.sumArr[ele].isChangedmBox){
                    this.sum_code_type = 2;
                }else{
                     this.sum_code_type = 1;
                }
            }else if(type === 7){ // 胆码
                this.biliaryArr[ele].isChangedmBox = !this.biliaryArr[ele].isChangedmBox;
                if(this.biliaryArr[ele].isChangedmBox){
                    switch(group){
                        case '胆码1': this.hundred_biliary_code_type = 2;break;
                        case '胆码2': this.ten_biliary_code_type = 2;break;
                        case '胆码3': this.position_biliary_code_type = 2;break;
                    }
                }else{
                     switch(group){
                        case '胆码1': this.hundred_biliary_code_type = 1;break;
                        case '胆码2': this.ten_biliary_code_type = 1;break;
                        case '胆码3': this.position_biliary_code_type = 1;break;
                    }
                }
            }else if(type === 8){ // 质合比
                this.sizeradioArr[ele].isChangedmBox = !this.sizeradioArr[ele].isChangedmBox;
                if(this.sizeradioArr[ele].isChangedmBox){
                    switch(group){
                        case '大小比': this.code_size_type = 2;break;
                        case '奇偶比': this.parity_radio_code_type = 2;break;
                        case '质合比': this.mass_radio_code_type = 2;break;
                    }
                }else{
                     switch(group){
                        case '大小比': this.code_size_type = 1;break;
                        case '奇偶比': this.parity_radio_code_type = 1;break;
                        case '质合比': this.mass_radio_code_type = 1;break;
                    }
                }
            }else if(type === 9){ // 012路
                this.type012Arr[ele].isChangedmBox = !this.type012Arr[ele].isChangedmBox;
                if(this.type012Arr[ele].isChangedmBox){
                    this.code_type_012_type = 2;
                }else{
                     this.code_type_012_type = 1;
                }
            }else if(type === 10){
                this.twodiffArr[ele].isChangedmBox = !this.twodiffArr[ele].isChangedmBox;
                if(this.twodiffArr[ele].isChangedmBox){
                    this.two_diff_code_type = 2;
                }else{
                     this.two_diff_code_type = 1;
                }
            }
        },

        // 全选
        onQxFun(index,type,group){
            if(type === 0){
                 for(var i in this.codeArr[index].numTextArr){
                    this.codeArr[index].numTextArr[i].status = 1;
                    switch(group){
                        case '最大号':
                                this.max_code_data.push(this.codeArr[index].numTextArr[i].num);
                            break;
                        case '最小号':
                                this.min_code_data.push(this.codeArr[index].numTextArr[i].num);
                            break;
                    }
                }
            }else if(type === 1){ //跨码
                for(var i in this.crossspanArr[index].numTextArr){ 
                    this.crossspanArr[index].numTextArr[i].status = 1;
                     this.cross_span_code_data.push(this.crossspanArr[index].numTextArr[i].num);
                }
            }else if(type === 2){ //类型
               for(var i in this.typeArr[index].numTextArr){
                    this.typeArr[index].numTextArr[i].status = 1;
                    this.code_type_data.push(this.typeArr[index].numTextArr[i].num);
                }
            }else if(type === 3){ //连号
                for(var i in this.linkCodeArr[index].numTextArr){
                    this.linkCodeArr[index].numTextArr[i].status = 1;
                    this.link_code_data.push(this.linkCodeArr[index].numTextArr[i].num);
                }
            }else if(type === 4){ //合值大小
                for(var i in this.sumsizeArr[index].numTextArr){
                    this.sumsizeArr[index].numTextArr[i].status = 1;
                    this.code_sum_size_data.push(this.sumsizeArr[index].numTextArr[i].num);
                }
            }else if(type === 5){ //合值奇偶
                for(var i in this.sumoddevenArr[index].numTextArr){
                    this.sumoddevenArr[index].numTextArr[i].status = 1;
                    this.code_sum_odd_even_data.push(this.sumoddevenArr[index].numTextArr[i].num);
                }
            }else if(type === 6){ //合值
                for(var i in this.sumArr[index].numTextArr){
                    this.sumArr[index].numTextArr[i].status = 1;
                    this.sum_code_data.push(this.sumArr[index].numTextArr[i].num);
                }
            }else if(type === 7){ //胆码
                 for(var i in this.biliaryArr[index].numTextArr){
                    this.biliaryArr[index].numTextArr[i].status = 1;
                    switch(group){
                        case '胆码1':
                                this.hundred_biliary_code_data.push(this.biliaryArr[index].numTextArr[i].num);
                            break;
                        case '胆码2':
                                this.ten_biliary_code_data.push(this.biliaryArr[index].numTextArr[i].num);
                            break;
                        case '胆码3':
                             this.position_biliary_code_data.push(this.biliaryArr[index].numTextArr[i].num);
                            break;
                    }
                }
            }else if(type === 8){ // 大小比
                for(var i in this.sizeradioArr[index].numTextArr){
                    this.sizeradioArr[index].numTextArr[i].status = 1;
                    switch(group){
                        case '大小比':
                            this.code_size_data.push(this.sizeradioArr[index].numTextArr[i].num);
                            break;
                        case '奇偶比':
                            this.parity_radio_code_data.push(this.sizeradioArr[index].numTextArr[i].num);
                            break;
                        case '质数比':
                            this.mass_radio_code_data.push(this.sizeradioArr[index].numTextArr[i].num);
                            break;
                    }
                }
            }else if(type === 9){ //012路
                for(var i in this.type012Arr[index].numTextArr){
                    this.type012Arr[index].numTextArr[i].status = 1;
                    this.code_type_012_data.push(this.type012Arr[index].numTextArr[i].num);
                }
            }else if(type === 10){ //二不同号
                for(var i in this.twodiffArr[index].numTextArr){
                    this.twodiffArr[index].numTextArr[i].status = 1;
                    this.two_diff_code_data.push(this.twodiffArr[index].numTextArr[i].num);
                }
            }
        },

        // 取消全选
        onQuXiaoFun(index,type,group){
            if(type === 0){
                 for(var i in this.codeArr[index].numTextArr){
                    this.codeArr[index].numTextArr[i].status = 0;
                    switch(group){
                        case '最大号':
                                this.max_code_data=[];
                            break;
                        case '最小号':
                                this.min_code_data=[];
                            break;
                    }
                }
            }else if(type === 1){ //跨码
                for(var i in this.crossspanArr[index].numTextArr){ 
                    this.crossspanArr[index].numTextArr[i].status = 0;
                     this.cross_span_code_data=[];
                }
            }else if(type === 2){ //类型
               for(var i in this.typeArr[index].numTextArr){
                    this.typeArr[index].numTextArr[i].status = 0;
                    this.code_type_data=[];
                }
            }else if(type === 3){ //连号
                for(var i in this.linkCodeArr[index].numTextArr){
                    this.linkCodeArr[index].numTextArr[i].status = 0;
                    this.link_code_data=[];
                }
            }else if(type === 4){ //合值大小
                for(var i in this.sumsizeArr[index].numTextArr){
                    this.sumsizeArr[index].numTextArr[i].status = 0;
                    this.code_sum_size_data=[];
                }
            }else if(type === 5){ //合值奇偶
                for(var i in this.sumoddevenArr[index].numTextArr){
                    this.sumoddevenArr[index].numTextArr[i].status = 0;
                    this.code_sum_odd_even_data=[];
                }
            }else if(type === 6){ //合值
                for(var i in this.sumArr[index].numTextArr){
                    this.sumArr[index].numTextArr[i].status = 0;
                    this.sum_code_data=[];
                }
            }else if(type === 7){ //胆码
                 for(var i in this.biliaryArr[index].numTextArr){
                    this.biliaryArr[index].numTextArr[i].status = 0;
                    switch(group){
                        case '胆码1':
                                this.hundred_biliary_code_data=[];
                            break;
                        case '胆码2':
                                this.ten_biliary_code_data=[];
                            break;
                        case '胆码3':
                             this.position_biliary_code_data=[];
                            break;
                    }
                }
            }else if(type === 8){ // 大小比
                for(var i in this.sizeradioArr[index].numTextArr){
                    this.sizeradioArr[index].numTextArr[i].status = 0;
                    switch(group){
                        case '大小比':
                            this.code_size_data=[];
                            break;
                        case '奇偶比':
                            this.parity_radio_code_data=[];
                            break;
                        case '质数比':
                            this.mass_radio_code_data=[];
                            break;
                    }
                }
            }else if(type === 9){ //012路
                for(var i in this.type012Arr[index].numTextArr){
                    this.type012Arr[index].numTextArr[i].status = 0;
                    this.code_type_012_data=[];
                }
            }else if(type === 10){ //二不同号
                for(var i in this.twodiffArr[index].numTextArr){
                    this.twodiffArr[index].numTextArr[i].status = 0;
                    this.two_diff_code_data=[];
                }
            }
        },

        // 选码切换
        onChangeItem(index,ele,type,group,val){
            if(type === 0){
                if(this.codeArr[index].numTextArr[ele].status){
                    this.codeArr[index].numTextArr[ele].status = 0;
                    switch(group){
                        case '最大号':
                                let index = this.max_code_data.indexOf(val);
                                if (index > -1) {
                                    this.max_code_data.splice(index, 1);
                                };
                            break;
                        case '最小号':
                                index = this.min_code_data.indexOf(val);
                                if (index > -1) {
                                    this.min_code_data.splice(index, 1);
                                };
                        break;
                    }
                }else{
                    this.codeArr[index].numTextArr[ele].status = 1;
                    switch(group){
                        case '最大号':
                            this.max_code_data.push(val);
                            break;
                        case '最小号':
                            this.min_code_data.push(val);
                        break;
                    }
                }
            }else if(type === 1){ // 跨码
                if(this.crossspanArr[index].numTextArr[ele].status){
                     this.crossspanArr[index].numTextArr[ele].status = 0;
                     index = this.cross_span_code_data.indexOf(val);
                    if (index > -1) {
                        this.cross_span_code_data.splice(index, 1);
                    };
                }else{
                    this.crossspanArr[index].numTextArr[ele].status = 1;
                    this.cross_span_code_data.push(val);
                }
            }else if(type === 2){ //类型
                if(this.typeArr[index].numTextArr[ele].status){
                     this.typeArr[index].numTextArr[ele].status = 0;
                     index = this.code_type_data.indexOf(val);
                    if (index > -1) {
                        this.code_type_data.splice(index, 1);
                    };
                }else{
                    this.typeArr[index].numTextArr[ele].status = 1;
                    this.code_type_data.push(val);
                }
            }else if(type === 3){
                if(this.linkCodeArr[index].numTextArr[ele].status){
                     this.linkCodeArr[index].numTextArr[ele].status = 0;
                     index = this.link_code_data.indexOf(val);
                    if (index > -1) {
                        this.link_code_data.splice(index, 1);
                    };
                }else{
                    this.linkCodeArr[index].numTextArr[ele].status = 1;
                    this.link_code_data.push(val);
                }
            }else if(type === 4){ //和值大小
                if(this.sumsizeArr[index].numTextArr[ele].status){
                     this.sumsizeArr[index].numTextArr[ele].status = 0;
                     index = this.code_sum_size_data.indexOf(val);
                    if (index > -1) {
                        this.code_sum_size_data.splice(index, 1);
                    };
                }else{
                    this.sumsizeArr[index].numTextArr[ele].status = 1;
                    this.code_sum_size_data.push(val);
                }
            }else if(type === 5){ //和值奇偶
            if(this.sumoddevenArr[index].numTextArr[ele].status){
                 this.sumoddevenArr[index].numTextArr[ele].status = 0;
                     index = this.code_sum_odd_even_data.indexOf(val);
                    if (index > -1) {
                        this.code_sum_odd_even_data.splice(index, 1);
                    };
                }else{
                    this.sumoddevenArr[index].numTextArr[ele].status = 1;
                    this.code_sum_odd_even_data.push(val);
                }                
            }else if(type === 6){ // 和值
                if(this.sumArr[index].numTextArr[ele].status){
                 this.sumArr[index].numTextArr[ele].status = 0;
                     index = this.sum_code_data.indexOf(val);
                    if (index > -1) {
                        this.sum_code_data.splice(index, 1);
                    };
                }else{
                    this.sumArr[index].numTextArr[ele].status = 1;
                    this.sum_code_data.push(val);
                }            
            }else if(type === 7){ //胆码
                  if(this.biliaryArr[index].numTextArr[ele].status){
                    this.biliaryArr[index].numTextArr[ele].status = 0;
                    switch(group){
                        case '胆码1':
                                let index = this.hundred_biliary_code_data.indexOf(val);
                                if (index > -1) {
                                    this.hundred_biliary_code_data.splice(index, 1);
                                };
                            break;
                        case '胆码2':
                                index = this.ten_biliary_code_data.indexOf(val);
                                if (index > -1) {
                                    this.ten_biliary_code_data.splice(index, 1);
                                };
                            break;
                        case '胆码3':
                                index = this.position_biliary_code_data.indexOf(val);
                                if (index > -1) {
                                    this.position_biliary_code_data.splice(index, 1);
                                };
                            break;
                    }
                }else{
                     this.biliaryArr[index].numTextArr[ele].status = 1;
                     switch(group){
                        case '胆码1':
                                this.hundred_biliary_code_data.push(val);
                            break;
                        case '胆码2':
                                this.ten_biliary_code_data.push(val);
                            break;
                        case '胆码3':
                                this.position_biliary_code_data.push(val);
                            break;
                    }
                }                
            }else if(type === 8){
                   if(this.sizeradioArr[index].numTextArr[ele].status){
                    this.sizeradioArr[index].numTextArr[ele].status = 0;
                    switch(group){
                        case '大小比':
                                let index = this.code_size_data.indexOf(val);
                                if (index > -1) {
                                    this.code_size_data.splice(index, 1);
                                };
                            break;
                        case '奇偶比':
                                index = this.parity_radio_code_data.indexOf(val);
                                if (index > -1) {
                                    this.parity_radio_code_data.splice(index, 1);
                                };
                            break;
                        case '质合比':
                                index = this.mass_radio_code_data.indexOf(val);
                                if (index > -1) {
                                    this.mass_radio_code_data.splice(index, 1);
                                };
                            break;
                    }
                }else{
                     this.sizeradioArr[index].numTextArr[ele].status = 1;
                     switch(group){
                        case '大小比':
                                this.code_size_data.push(val);
                            break;
                        case '奇偶比':
                                this.parity_radio_code_data.push(val);
                            break;
                        case '质合比':
                                this.mass_radio_code_data.push(val);
                            break;
                    }
                }
            }else if(type === 9){
                if(this.type012Arr[index].numTextArr[ele].status){
                 this.type012Arr[index].numTextArr[ele].status = 0;
                     index = this.code_type_012_data.indexOf(val);
                    if (index > -1) {
                        this.code_type_012_data.splice(index, 1);
                    };
                }else{
                    this.type012Arr[index].numTextArr[ele].status = 1;
                    this.code_type_012_data.push(val);
                }   
            }else if(type === 10){
                if(this.twodiffArr[index].numTextArr[ele].status){
                 this.twodiffArr[index].numTextArr[ele].status = 0;
                     index = this.two_diff_code_data.indexOf(val);
                    if (index > -1) {
                        this.two_diff_code_data.splice(index, 1);
                    };
                }else{
                    this.twodiffArr[index].numTextArr[ele].status = 1;
                    this.two_diff_code_data.push(val);
                }   
            }
        },

        // 生成
        onGenerateFun(){
            this.is_turn=0;
            this.is_client_export = 0;
            this.postClientShrinkageToolDataOfL28AndK3();
        },

        // 转组选
        onRotationGroupFun(){
            this.is_turn=1;
            this.is_client_export = 0;
            this.postClientShrinkageToolDataOfL28AndK3();
        },

        // 导出
        onExportFun(){
            this.is_turn=0;
            this.is_client_export = 1;
            this.postClientShrinkageToolDataOfL28AndK3();
        },

        // 复制
        onCopyFun(){
            let text=document.getElementById("textCont");
            text.select(); // 选择对象
            document.execCommand("Copy");  //执行浏览器拷贝
        },

        // 重置所有条件
        onResetFun(){
            this.resetNum();
        },

         // 重置所有条件
        resetNum(){
            this.NumVal='';
            this.total_num=0;
             this.max_code_type=1, //最大号
             this.min_code_type=1,  //最小号
             this.hundred_biliary_code_type=1, //百位胆码
             this.ten_biliary_code_type=1, // 十位胆码
             this.position_biliary_code_type=1, // 个位胆码
             this.cross_span_code_type=1, // 跨度
             this.code_type_type=1, // 类型
             this.code_size_type=1, // 大小比
             this.parity_radio_code_type=1, // 奇偶比
             this.mass_radio_code_type=1, // 质合比
             this.link_code_type=1, // 连号
             this.code_type_012_type=1, // 012
             this.code_sum_size_type=1,  // 合值大小
             this.code_sum_odd_even_type=1, // 合值奇偶
             this.sum_code_type=1,  // 合值
             this.two_diff_code_type=1, // 2不同号
             
             this.max_code_data=[],
             this.min_code_data=[],
             this.hundred_biliary_code_data=[],
             this.ten_biliary_code_data=[],
             this.position_biliary_code_data=[],
             this.cross_span_code_data=[],
             this.code_type_data=[],
             this.code_size_data=[],
             this.parity_radio_code_data=[],
             this.mass_radio_code_data=[],
             this.link_code_data=[],
             this.code_type_012_data=[],
             this.code_sum_size_data=[],
             this.code_sum_odd_even_data=[],
             this.sum_code_data=[],
             this.two_diff_code_data=[];
             for(let i in this.codeArr){
                this.codeArr[i].isChangedmBox = false;
                for(let k in  this.codeArr[i].numTextArr){
                    this.codeArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.crossspanArr){
                this.crossspanArr[i].isChangedmBox = false;
                for(let k in  this.crossspanArr[i].numTextArr){
                    this.crossspanArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.typeArr){
                this.typeArr[i].isChangedmBox = false;
                for(let k in  this.typeArr[i].numTextArr){
                    this.typeArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.linkCodeArr){
                this.linkCodeArr[i].isChangedmBox = false;
                for(let k in  this.linkCodeArr[i].numTextArr){
                    this.linkCodeArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.sumsizeArr){
                this.sumsizeArr[i].isChangedmBox = false;
                for(let k in  this.sumsizeArr[i].numTextArr){
                    this.sumsizeArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.sumoddevenArr){
                this.sumoddevenArr[i].isChangedmBox = false;
                for(let k in  this.sumoddevenArr[i].numTextArr){
                    this.sumoddevenArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.sumArr){
                this.sumArr[i].isChangedmBox = false;
                for(let k in  this.sumArr[i].numTextArr){
                    this.sumArr[i].numTextArr[k].status = 0;
                }
            }   
            for(let i in this.biliaryArr){
                this.biliaryArr[i].isChangedmBox = false;
                for(let k in  this.biliaryArr[i].numTextArr){
                    this.biliaryArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.sizeradioArr){
                this.sizeradioArr[i].isChangedmBox = false;
                for(let k in  this.sizeradioArr[i].numTextArr){
                    this.sizeradioArr[i].numTextArr[k].status = 0;
                }
            }                               
            for(let i in this.type012Arr){
                this.type012Arr[i].isChangedmBox = false;
                for(let k in  this.type012Arr[i].numTextArr){
                    this.type012Arr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.twodiffArr){
                this.twodiffArr[i].isChangedmBox = false;
                for(let k in  this.twodiffArr[i].numTextArr){
                    this.twodiffArr[i].numTextArr[k].status = 0;
                }
            }
        },

        // 获取网络数据
        postClientShrinkageToolDataOfL28AndK3(){
            let lottery_id = this.$store.state.lottery_id;
            let is_k3 = this.CaiPiaoType == 'k3' ? 1 : 0;
            this.https('Analyse/postClientShrinkageToolDataOfL28AndK3',{
                lottery_id:lottery_id,
                star_num: this.star_num,
                is_k3: is_k3,
                is_turn: this.is_turn,
                max_code:{
                    type: this.max_code_type,
                    data: this.max_code_data.toString()
                },
                min_code:{
                    type: this.min_code_type,
                    data: this.min_code_data.toString()
                },
                hundred_biliary_code:{
                    type: this.hundred_biliary_code_type,
                    data: this.hundred_biliary_code_data.toString()
                },
                ten_biliary_code:{
                    type: this.ten_biliary_code_type,
                    data: this.ten_biliary_code_data.toString()
                },
                position_biliary_code:{
                    type: this.position_biliary_code_type,
                    data: this.position_biliary_code_data.toString()
                },
                cross_span_code:{
                    type: this.cross_span_code_type,
                    data: this.cross_span_code_data.toString()
                },
                code_type:{
                    type: this.code_type_type,
                    data: this.code_type_data.toString()
                },
                code_size:{
                    type: this.code_size_type,
                    data: this.code_size_data.toString()
                },
                parity_radio_code:{
                    type: this.parity_radio_code_type,
                    data: this.parity_radio_code_data.toString()
                },
                mass_radio_code:{
                    type: this.mass_radio_code_type,
                    data: this.mass_radio_code_data.toString()
                },
                link_code:{
                    type: this.link_code_type,
                    data: this.link_code_data.toString()
                },
                code_type_012:{
                    type: this.code_type_012_type,
                    data: this.code_type_012_data.toString()
                },
                code_sum_size:{
                    type: this.code_sum_size_type,
                    data: this.code_sum_size_data.toString()
                },
                code_sum_odd_even:{
                    type: this.code_sum_odd_even_type,
                    data: this.code_sum_odd_even_data.toString()
                },
                sum_code:{
                    type: this.sum_code_type,
                    data: this.sum_code_data.toString()
                },
                two_diff_code:{
                    type: this.two_diff_code_type,
                    data: this.two_diff_code_data.toString()
                }
            },'post')
            .then(data => {
                        let root = '';
                        this.total_num = data.total_num;
                        for(var i in data.list){
                            if(root == ''){
                                root = data.list[i]
                            }else{
                                root = root +' '+data.list[i]
                            }
                        }
                    if(this.total_num != 0){
                        if(this.is_client_export == 1){
                            this.ondownload(root);
                        }else{
                            this.NumVal = root;
                        }
                    }else{
                        this.$toast({message:'本次生成0注，请重新选择号码缩水条件。'});
                        this.NumVal = '';
                    }
            })
        },

        // 下载文件
        ondownload(data){ //下载txt文件
            var CaiPiaoLabel = this.$store.state.CaiPiaoLabel;
            var name = `[彩盟计划][${CaiPiaoLabel}]${this.file_name}`
            download(data, name, "text/plain");
        }
    }
}
</script>
<style lang="less" scoped>
    @import url(../../assets/css/shrinkagetool/shrinkagetool123.less);
</style>


